import type { AxiosRequestConfig } from 'axios'
import type { ApiResult } from '@/types/app'
import type { RequestOptions } from '@/utils/http'
import type { GetAssetsList, GetAssetsTree } from './type'
import { http } from '@/utils/http'

/**
 * 资源管理 API
 */
export const resourceManagementApi = {
  /** 获取资产列表 */
  getAssetsList(config?: AxiosRequestConfig<GetAssetsList>, options?: RequestOptions) {
    return http.get<ApiResult>({ url: '/resource-management/api/v1/resource', ...config }, options)
  },
  /** 树-资产组 */
  getAssetsTree(config?: AxiosRequestConfig<GetAssetsTree>, options?: RequestOptions) {
    return http.get({ url: '/resource-management/api/v1/business/all', ...config }, options)
  },
  /** 获取资产类型树 */
  getAssetTypes(config?: AxiosRequestConfig, options?: RequestOptions) {
    return http.get<ApiResult>({ url: '/resource-management/api/v1/resource-type/getAll', ...config }, options)
  }
}
